package example3;

import java.lang.reflect.Proxy;

public class ProxyDemo {
	public static void main(String[] args) {
		HelloSpeaker helloSpeaker = new HelloSpeaker();
		DynamicProxy dynamicProxy = new DynamicProxy(helloSpeaker);
		
		Class cls = helloSpeaker.getClass();
		IHello iHello = (IHello) Proxy.newProxyInstance(cls.getClassLoader(),
				cls.getInterfaces(), dynamicProxy);
		
		iHello.hello("zhangsan");
		iHello.hello2("lisi");
		iHello.hello3("wangwu");
	}
}
